package leetcode.weekly.week341;

//Solution2Test
public class Solution2 {

	public int maxDivScore(int[] nums, int[] divisors) {
		int ans = Integer.MAX_VALUE, anss = 0;
		for (int d : divisors) {
			int s = 0;
			for (int num : nums) {
				if (num % d == 0) {
					s++;
				}
			}
			if (s > anss) {
				anss = s;
				ans = d;
			} else if (s == anss) {
				ans = Math.min(ans, d);
			}
		}
		return ans;
	}

}
